{include file="public/header"}
<body>
	<div class="logo_section1">
		<img src="__PUBLIC__/home/images/materialPreview.png" alt="">
	</div>
	<div class="logo_section2">
		<div class="container2">
			<form action="">
				<div class="f1">
					<img src="__PUBLIC__/home/images/login_icon_user.png" alt="" class="im1">
					<input type="text" name="telephone" class="input1" placeholder="请填写手机号">
				</div>
				<div class="f1">
					<img src="__PUBLIC__/home/images/login_icon_pw1.png" alt="" class="im2">
					<input type="text" name="vcode" class="input1" placeholder="请填写验证码">
					<span class="s1_btn" id="getVcode">获取验证码</span>
				</div>
				<div class="sub">
					<input type="button" value="登录" id="submit">
				</div>
				{include file="public/reg_forget"}
				<div class="ur">
					<span class="s1"></span>
					<a href="{:url('login')}" class="s2">密码登录</a>
					<span class="s3"></span>
				</div>
			</form>
		</div>
	</div>
</body>
<script>
	$(function(){
		$("#getVcode").on('click', function () {
			let telephone = $.trim($("input[name='telephone']").val());
			if(telephone == ""){
				modal.msg("请输入手机号")
				return;
			}
			let o = this;
			$(o).attr("disabled");
			let sec = 60;
			$.post('{:url("getVcode")}', {telephone:telephone, type:3}, function (res) {
				modal.msg(res.result_info);
				if(res.result_code == 0){
					let i = setInterval(function () {
						$(o).html(sec+"秒");
						sec--;
						if(sec<1){
							clearInterval(i);
							$(o).removeAttr("disabled");
						}
					}, 1000);
				}else{
					$(o).removeAttr("disabled");
				}
			});
		});
		$("#submit").click(function () {
			let telephone = $("input[name='telephone']").val();
			let vcode = $("input[name='vcode']").val();
			if(telephone == ''){
				modal.msg("请输入手机号");
				return;
			}
			if(vcode== ''){
				modal.msg("请输入密码");
				return;
			}
			let index = modal.loading();
			$.post(location.href, {telephone:telephone, vcode:vcode}, function (res) {
				modal.close(index);
				if(res.result_code == 0){
					modal.msg("登录成功");
					setTimeout(function () {
						location.replace('{:url("Index/index", ["is_login"=>1])}');
					},666);
				}else{
					modal.msg(res.result_info);
				}
			});
		});
		
		
	})
</script>
</html>